package com.study.bob.singleTon;

/**
 * Created by bob on 2016/5/2.
 */
public class ThreadSafeSingleton {
    private static ThreadSafeSingleton instance = null;

    private ThreadSafeSingleton(){

    }

    //同步关键字synchronized
    public static synchronized ThreadSafeSingleton getInstance(){
        if(instance == null){
            instance = new ThreadSafeSingleton();
        }
        return  instance;
    }

}
